package leetcode;

/**
 * https://leetcode-cn.com/problems/reverse-string/description/
 * https://leetcode.com/problems/reverse-string/?tab=Description
 *
 * @program: brushing
 * @description:
 * @author: LiuQiang
 * @create: 2018-07-25 10:34
 **/
public class ReverseString {
    public String test(String s) {
        StringBuffer result = new StringBuffer();

        if (s != null || s.length() > 0) {
            String s1[] = s.split("");

            for (int i = s1.length - 1; i >= 0; i--) {
                result.append(s1[i]);
            }
        }

        return result.toString();
    }

    public static void main(String[] args) {
        ReverseString r = new ReverseString();
        String s = "hello";
        String t = r.test(s);
        System.out.println(t);
    }
}
